/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ronsicecream.pos.entities;

import com.buanalintas.bynga.entities.MasterUnit;
import com.buanalintas.bynga.entities.MasterUser;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author user
 */
@Entity
@Table(name = "pos_transaction_ho_purchase_order_supplier")
@XmlRootElement
//@NamedQueries({
//    @NamedQuery(name = "PosTransactionHoPurchaseOrderSupplier.findAll", query = "SELECT p FROM PosTransactionHoPurchaseOrderSupplier p"),
//    @NamedQuery(name = "PosTransactionHoPurchaseOrderSupplier.findBySync", query = "SELECT p FROM PosTransactionHoPurchaseOrderSupplier p WHERE p.sync = :sync"),
//    @NamedQuery(name = "PosTransactionHoPurchaseOrderSupplier.findByPurchaseOrderId", query = "SELECT p FROM PosTransactionHoPurchaseOrderSupplier p WHERE p.purchaseOrderId = :purchaseOrderId"),
//    @NamedQuery(name = "PosTransactionHoPurchaseOrderSupplier.findByPurchaseOrderNumber", query = "SELECT p FROM PosTransactionHoPurchaseOrderSupplier p WHERE p.purchaseOrderNumber = :purchaseOrderNumber"),
//    @NamedQuery(name = "PosTransactionHoPurchaseOrderSupplier.findByPurchaseOrderDate", query = "SELECT p FROM PosTransactionHoPurchaseOrderSupplier p WHERE p.purchaseOrderDate = :purchaseOrderDate"),
//    @NamedQuery(name = "PosTransactionHoPurchaseOrderSupplier.findByPurchaseOrderStatus", query = "SELECT p FROM PosTransactionHoPurchaseOrderSupplier p WHERE p.purchaseOrderStatus = :purchaseOrderStatus"),
//    @NamedQuery(name = "PosTransactionHoPurchaseOrderSupplier.findByPurchaseOrderKeel", query = "SELECT p FROM PosTransactionHoPurchaseOrderSupplier p WHERE p.purchaseOrderKeel = :purchaseOrderKeel"),
//    @NamedQuery(name = "PosTransactionHoPurchaseOrderSupplier.findByPurchaseOrderTotal", query = "SELECT p FROM PosTransactionHoPurchaseOrderSupplier p WHERE p.purchaseOrderTotal = :purchaseOrderTotal"),
//    @NamedQuery(name = "PosTransactionHoPurchaseOrderSupplier.findByPurchaseOrderQuantity", query = "SELECT p FROM PosTransactionHoPurchaseOrderSupplier p WHERE p.purchaseOrderQuantity = :purchaseOrderQuantity"),
//    @NamedQuery(name = "PosTransactionHoPurchaseOrderSupplier.findByPurchaseOrderPaid", query = "SELECT p FROM PosTransactionHoPurchaseOrderSupplier p WHERE p.purchaseOrderPaid = :purchaseOrderPaid"),
//    @NamedQuery(name = "PosTransactionHoPurchaseOrderSupplier.findByPurchaseOrderReceived", query = "SELECT p FROM PosTransactionHoPurchaseOrderSupplier p WHERE p.purchaseOrderReceived = :purchaseOrderReceived"),
//    @NamedQuery(name = "PosTransactionHoPurchaseOrderSupplier.findByPurchaseOrderUnreceived", query = "SELECT p FROM PosTransactionHoPurchaseOrderSupplier p WHERE p.purchaseOrderUnreceived = :purchaseOrderUnreceived"),
//    @NamedQuery(name = "PosTransactionHoPurchaseOrderSupplier.findByPurchaseOrderProgress", query = "SELECT p FROM PosTransactionHoPurchaseOrderSupplier p WHERE p.purchaseOrderProgress = :purchaseOrderProgress"),
//    @NamedQuery(name = "PosTransactionHoPurchaseOrderSupplier.findByPurchaseOrderTimestamp", query = "SELECT p FROM PosTransactionHoPurchaseOrderSupplier p WHERE p.purchaseOrderTimestamp = :purchaseOrderTimestamp")})
public class PosTransactionHoPurchaseOrderSupplier implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "purchase_order_id")
    private Integer purchaseOrderId;
    @Column(name = "purchase_order_number")
    private String purchaseOrderNumber;
    @Column(name = "purchase_order_date")
    @Temporal(TemporalType.DATE)
    private Date purchaseOrderDate;
    @Column(name = "purchase_order_status")
    private String purchaseOrderStatus;
    @Column(name = "purchase_order_reject_reason")
    private String purchaseOrderRejectReason;
    @Column(name = "purchase_order_keel")
    private String purchaseOrderKeel;
    @Column(name = "purchase_order_total")
    private BigDecimal purchaseOrderTotal;
    @Column(name = "purchase_order_quantity")
    private BigDecimal purchaseOrderQuantity;
    @Column(name = "purchase_order_paid")
    private BigDecimal purchaseOrderPaid;
    @Column(name = "purchase_order_received")
    private BigDecimal purchaseOrderReceived;
    @Column(name = "purchase_order_unreceived")
    private BigDecimal purchaseOrderUnreceived;
    @Column(name = "purchase_order_progress")
    private String purchaseOrderProgress;
    @Lob
    @Column(name = "purchase_order_description")
    private String purchaseOrderDescription;
    @Column(name = "purchase_order_timestamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date purchaseOrderTimestamp;
    @JoinColumn(name = "purchase_order_pos_unit_id", referencedColumnName = "unit_id")
    @ManyToOne
    private PosMasterUnit purchaseOrderPosUnitId;
    @JoinColumn(name = "purchase_order_supplier_id", referencedColumnName = "supplier_id")
    @ManyToOne(optional = false)
    private PosMasterSupplier purchaseOrderSupplierId;
    @JoinColumn(name = "purchase_order_regional_id", referencedColumnName = "regional_id")
    @ManyToOne(optional = false)
    private PosMasterRegional purchaseOrderRegionalId;
    @JoinColumn(name = "purchase_order_unit_id", referencedColumnName = "unit_id")
    @ManyToOne
    private MasterUnit purchaseOrderUnitId;
    @JoinColumn(name = "purchase_order_user_id", referencedColumnName = "user_id")
    @ManyToOne
    private MasterUser purchaseOrderUserId;
   
    public PosTransactionHoPurchaseOrderSupplier() {
    }

    public PosTransactionHoPurchaseOrderSupplier(Integer purchaseOrderId) {
        this.purchaseOrderId = purchaseOrderId;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public Integer getPurchaseOrderId() {
        return purchaseOrderId;
    }

    public String getPurchaseOrderRejectReason() {
        return purchaseOrderRejectReason;
    }

    public void setPurchaseOrderRejectReason(String purchaseOrderRejectReason) {
        this.purchaseOrderRejectReason = purchaseOrderRejectReason;
    }
    
    public void setPurchaseOrderId(Integer purchaseOrderId) {
        this.purchaseOrderId = purchaseOrderId;
    }

    public String getPurchaseOrderNumber() {
        return purchaseOrderNumber;
    }

    public void setPurchaseOrderNumber(String purchaseOrderNumber) {
        this.purchaseOrderNumber = purchaseOrderNumber;
    }

    public Date getPurchaseOrderDate() {
        return purchaseOrderDate;
    }

    public void setPurchaseOrderDate(Date purchaseOrderDate) {
        this.purchaseOrderDate = purchaseOrderDate;
    }

    public String getPurchaseOrderStatus() {
        return purchaseOrderStatus;
    }

    public void setPurchaseOrderStatus(String purchaseOrderStatus) {
        this.purchaseOrderStatus = purchaseOrderStatus;
    }

    public String getPurchaseOrderKeel() {
        return purchaseOrderKeel;
    }

    public void setPurchaseOrderKeel(String purchaseOrderKeel) {
        this.purchaseOrderKeel = purchaseOrderKeel;
    }

    public BigDecimal getPurchaseOrderReceived() {
        return purchaseOrderReceived;
    }

    public void setPurchaseOrderReceived(BigDecimal purchaseOrderReceived) {
        this.purchaseOrderReceived = purchaseOrderReceived;
    }

    public BigDecimal getPurchaseOrderUnreceived() {
        return purchaseOrderUnreceived;
    }

    public void setPurchaseOrderUnreceived(BigDecimal purchaseOrderUnreceived) {
        this.purchaseOrderUnreceived = purchaseOrderUnreceived;
    }

    public String getPurchaseOrderProgress() {
        return purchaseOrderProgress;
    }

    public void setPurchaseOrderProgress(String purchaseOrderProgress) {
        this.purchaseOrderProgress = purchaseOrderProgress;
    }

    public String getPurchaseOrderDescription() {
        return purchaseOrderDescription;
    }

    public void setPurchaseOrderDescription(String purchaseOrderDescription) {
        this.purchaseOrderDescription = purchaseOrderDescription;
    }

    public Date getPurchaseOrderTimestamp() {
        return purchaseOrderTimestamp;
    }

    public void setPurchaseOrderTimestamp(Date purchaseOrderTimestamp) {
        this.purchaseOrderTimestamp = purchaseOrderTimestamp;
    }

    public PosMasterUnit getPurchaseOrderPosUnitId() {
        return purchaseOrderPosUnitId;
    }

    public void setPurchaseOrderPosUnitId(PosMasterUnit purchaseOrderPosUnitId) {
        this.purchaseOrderPosUnitId = purchaseOrderPosUnitId;
    }

    public BigDecimal getPurchaseOrderTotal() {
        return purchaseOrderTotal;
    }

    public void setPurchaseOrderTotal(BigDecimal purchaseOrderTotal) {
        this.purchaseOrderTotal = purchaseOrderTotal;
    }

    public BigDecimal getPurchaseOrderQuantity() {
        return purchaseOrderQuantity;
    }

    public void setPurchaseOrderQuantity(BigDecimal purchaseOrderQuantity) {
        this.purchaseOrderQuantity = purchaseOrderQuantity;
    }

    public BigDecimal getPurchaseOrderPaid() {
        return purchaseOrderPaid;
    }

    public void setPurchaseOrderPaid(BigDecimal purchaseOrderPaid) {
        this.purchaseOrderPaid = purchaseOrderPaid;
    }

    public PosMasterSupplier getPurchaseOrderSupplierId() {
        return purchaseOrderSupplierId;
    }

    public void setPurchaseOrderSupplierId(PosMasterSupplier purchaseOrderSupplierId) {
        this.purchaseOrderSupplierId = purchaseOrderSupplierId;
    }

    public PosMasterRegional getPurchaseOrderRegionalId() {
        return purchaseOrderRegionalId;
    }

    public void setPurchaseOrderRegionalId(PosMasterRegional purchaseOrderRegionalId) {
        this.purchaseOrderRegionalId = purchaseOrderRegionalId;
    }

    public MasterUnit getPurchaseOrderUnitId() {
        return purchaseOrderUnitId;
    }

    public void setPurchaseOrderUnitId(MasterUnit purchaseOrderUnitId) {
        this.purchaseOrderUnitId = purchaseOrderUnitId;
    }

    public MasterUser getPurchaseOrderUserId() {
        return purchaseOrderUserId;
    }

    public void setPurchaseOrderUserId(MasterUser purchaseOrderUserId) {
        this.purchaseOrderUserId = purchaseOrderUserId;
    }

    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (purchaseOrderId != null ? purchaseOrderId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosTransactionHoPurchaseOrderSupplier)) {
            return false;
        }
        PosTransactionHoPurchaseOrderSupplier other = (PosTransactionHoPurchaseOrderSupplier) object;
        if ((this.purchaseOrderId == null && other.purchaseOrderId != null) || (this.purchaseOrderId != null && !this.purchaseOrderId.equals(other.purchaseOrderId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return purchaseOrderNumber;
//        return "com.ronsicecream.pos.entities.PosTransactionHoPurchaseOrderSupplier[ purchaseOrderId=" + purchaseOrderId + " ]";
    }
    
}
